﻿@model Proggy.Web.Cms.ViewModels.ContentHomeViewModel
@{
    ViewBag.Title = "Content";

    Html.AddToBackEndContent("~/Areas/Proggy/Content/Scripts/Proggy.ContentHome.js", BackEndContentType.JavaScript);
}
<h2>
    @ViewBag.Title</h2>
<div id="proggy_contenttree">
    @if (Model.NoRootNode)
    {
        // no root node created yet
        <div class="proggy-div">
            <h3>
                No content created yet!</h3>
            <p>@Html.ActionLink("Create root content node >>", "Create")</p>
            <p class="italic red">
                It is suggested that you are very careful about doing this owing to the nature of
                creating content in Proggy. Please make absolutely sure you choose the correct content
                type otherwise subsequent changes may be difficult. Contact your Proggy administrator
                if you are unsure.</p>
        </div>
    }
    else
    {

        // get id for site map
        var areaId = "sm_" + DateTime.Now.ToFileTimeUtc() + "_sm";

        // render site map
        Html.RenderAction("SiteMap", new { areaId = areaId, controller = "Content", area = "Proggy", includeContentMenu = true, asPublished = false });

        // add script function
        <script type="text/javascript">

            Proggy.Static.WaitForTypesToRegister(function () {

                //
                var siteMap = new Proggy.SiteMap();

                //
                siteMap.Init("@areaId", true, false, function () { });

            });

        </script>
    }
    @{
        Html.RenderAction("TrashedContentPartial");   
    }
    <script type="text/javascript">
        jQuery(function () {
            var init = new Proggy.ContentHome();
            init.Init();
        });
    </script>
</div>
